<template>
  <div>
    <form @submit.prevent="fn">
      <label>姓名：</label>
      <input type="text" v-model="form.nume" /><br /><br />

      <label>年龄：</label>
      <input type="number" v-model="form.age" /><br /><br />

      <label>身高：</label>
      <input type="number" step="0.01" v-model="form.height" />(米)<br /><br />

      <label>体重：</label>
      <input type="number" v-model="form.weight" />(公斤)<br /><br />

      <label>病史：</label>
      <input type="text" v-model="form.medicalHistory" /><br /><br />

      <button>诊断</button>
    </form>

    <p v-if="flag">
      患者 {{ form.nume }} 的诊断结果：{{
        this.bidi >= 24.9?'太胖了':
        this.bidi <= 24.9 && this.bidi <= 18.5 ? '小伙子身体真好':'你是细狗吗'
      }}
      <!-- <span v-if="form.weight / (form.height * form.height) >= 24.9" >{{bide = '体重过重'}} </span>
      <span v-if="form.weight / (form.height *form.height) <= 18.5">{{bide = '体重过轻'}}</span>
      <span
        v-if="
          form.weight / (form.height * form.height) >= 18.5 &&
          form.weight / (form.height * form.height) <= 24.9
        "
        >健康</span> -->
    </p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      flag: false,
      form: {
        bug: "xiaomi",
        nume: "",
        age: "",
        height: "",
        weight: "",
        medicalHistory: "",
      },
      bidi:''
    };
  },
  methods: {
    fn() {
      this.flag = true;
      this.bidi = this.form.weight/(this.form.height*this.form.height)
    },
  },
};
</script>
